package com.learn.concurrent;

/**
 * @author wangxing
 * @version 2020/8/2 20:26 Administrator
 */
public class ThreadLearn {
    public static void learnYield(){
        new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println("-----------A"+i);
                if(i%10==0){
                    Thread.yield();
                }
            }
        }).start();
        new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println("--------------------B"+i);
                if(i%10==0){
                    Thread.yield();
                }
            }
        }).start();

    }
}
